﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Light_Notes
{
    public class HotkeyEx : ManagedWinapi.Hotkey
    {
        public HotkeyEx() : base() { }

        public HotkeyEx(int code)
            : base()
        {
            if ((code & 1) != 0) Alt = true;
            if ((code & 2) != 0) Ctrl = true;
            if ((code & 4) != 0) Shift = true;
            if ((code & 8) != 0) WindowsKey = true;
            KeyCode = (System.Windows.Forms.Keys)(code >> 4);
        }

        public int ToInt()
        {
            int i = (int)KeyCode << 4;
            if (Alt) i += 1;
            if (Ctrl) i += 2;
            if (Shift) i += 4;
            if (WindowsKey) i += 8;
            return i;
        }
    }
}
